package com.zbkj.common.model.shop;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Objects;

/**
 * 限时团购商品表
 */
@Slf4j
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("eb_group_purchase")
@ApiModel(value = "限时团购商品", description = "限时团购商品表")
public class EbGroupPurchase implements Serializable {

    private static final long serialVersionUID = -3242646941692582211L;
    @ApiModelProperty(value = "团购ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "商户id")
    private Integer merId;

    @ApiModelProperty(value = "商户名称")
    private String merName;

    @ApiModelProperty(value = "团购商品名称")
    private String name;

    @ApiModelProperty(value = "精简标题")
    private String title;

    @ApiModelProperty(value = "商品原价")
    private BigDecimal originalPrice;

    @ApiModelProperty(value = "团购价格")
    private BigDecimal groupPrice;

    @ApiModelProperty(value = "优惠购买数量")
    private Integer discountsNum;

    @ApiModelProperty(value = "商品类目ID")
    private Integer categoryId;

    @ApiModelProperty(value = "开始时间")
    private Date startTime;

    @ApiModelProperty(value = "结束时间")
    private Date endTime;

    @ApiModelProperty(value = "商品库存")
    private Integer stock;

    @ApiModelProperty(value = "库存预警值")
    private Integer stockWarning;

    @ApiModelProperty(value = "单团最大份数(单个账户购买上限)")
    private Integer maxPerUser;

    @ApiModelProperty(value = "商品列表封面图URL")
    private String shopListImage;

    @ApiModelProperty(value = "商品主页banner图URL")
    private String bannerImages;

    @ApiModelProperty(value = "商品主页banner视频URL")
    private String bannerVideo;

    @ApiModelProperty(value = "广告载体引导页视频URL")
    private String guideVideo;

    @ApiModelProperty(value = "适用店铺类型(0-通用，1-指定店铺)")
    private Boolean shopType;

    @ApiModelProperty(value = "备注(如免费WIFI停车等)")
    private String notes;

    @ApiModelProperty(value = "详情图URL列表(多张逗号区分)")
    private String detailImages;

    @ApiModelProperty(value = "有效期 天,永久-1")
    private String validityPeriod;

    @ApiModelProperty(value = "过期自动退(0-否，1-是)")
    private Boolean autoRefundExpired;

    @ApiModelProperty(value = "随时退(0-否，1-是)")
    private Boolean anytimeRefund;

    @ApiModelProperty(value = "使用须知(如可堂食，可打包等)")
    private String usageNotes;
    private String remarks;
    private String shopNames;

    @ApiModelProperty(value = "状态(0-下架，1-上架)")
    private Boolean status;
    /**
     * 是否删除
     */
    private Integer isDelete;
    /**
     * 是否包含全部店铺
     */
    private Integer isAllShop;
    @ApiModelProperty(value = "审核状态(0-待审核，1-已审核，2已拒绝)")
    private Integer checkStatus;
    /**
     * 成交次数
     */
    private int payNum;
    /**
     * 销量
     */
    private int salesVolume;
    private int placementNum;
    private int scanCodeNum;
    private int conversionRate;
    private int sortNum;
    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @ApiModelProperty(value = "更新时间")
    private Date updateTime;

    public boolean isEbGroupPurchaseEqual(EbGroupPurchase other) {
        if (other == null) {
            return false;
        }


        if (!Objects.equals(this.name, other.name)) {
            log.info("name数据不同: 当前值=" + this.name + ", 比较值=" + other.name);
            return false;
        }

        if (!Objects.equals(this.title, other.title)) {
            log.info("title数据不同: 当前值=" + this.title + ", 比较值=" + other.title);
            return false;
        }

        if (!Objects.equals(this.originalPrice, other.originalPrice)) {
            log.info("originalPrice数据不同: 当前值=" + this.originalPrice + ", 比较值=" + other.originalPrice);
            return false;
        }

        if (!Objects.equals(this.groupPrice, other.groupPrice)) {
            log.info("groupPrice数据不同: 当前值=" + this.groupPrice + ", 比较值=" + other.groupPrice);
            return false;
        }

        if (!Objects.equals(this.discountsNum, other.discountsNum)) {
            log.info("discountsNum数据不同: 当前值=" + this.discountsNum + ", 比较值=" + other.discountsNum);
            return false;
        }

        if (!Objects.equals(this.categoryId, other.categoryId)) {
            log.info("categoryId数据不同: 当前值=" + this.categoryId + ", 比较值=" + other.categoryId);
            return false;
        }

        if (!Objects.equals(this.maxPerUser, other.maxPerUser)) {
            log.info("maxPerUser数据不同: 当前值=" + this.maxPerUser + ", 比较值=" + other.maxPerUser);
            return false;
        }

        if (!Objects.equals(this.shopListImage, other.shopListImage)) {
            log.info("shopListImage数据不同: 当前值=" + this.shopListImage + ", 比较值=" + other.shopListImage);
            return false;
        }

        if (!Objects.equals(this.bannerImages, other.bannerImages)) {
            log.info("bannerImages数据不同: 当前值=" + this.bannerImages + ", 比较值=" + other.bannerImages);
            return false;
        }

        if (!Objects.equals(this.bannerVideo, other.bannerVideo)) {
            log.info("bannerVideo数据不同: 当前值=" + this.bannerVideo + ", 比较值=" + other.bannerVideo);
            return false;
        }

        if (!Objects.equals(this.guideVideo, other.guideVideo)) {
            log.info("guideVideo数据不同: 当前值=" + this.guideVideo + ", 比较值=" + other.guideVideo);
            return false;
        }

        if (!Objects.equals(this.shopType, other.shopType)) {
            log.info("shopType数据不同: 当前值=" + this.shopType + ", 比较值=" + other.shopType);
            return false;
        }

        if (!Objects.equals(this.notes, other.notes)) {
            log.info("notes数据不同: 当前值=" + this.notes + ", 比较值=" + other.notes);
            return false;
        }

        if (!Objects.equals(this.detailImages, other.detailImages)) {
            log.info("detailImages数据不同: 当前值=" + this.detailImages + ", 比较值=" + other.detailImages);
            return false;
        }

        if (!Objects.equals(this.validityPeriod, other.validityPeriod)) {
            log.info("validityPeriod数据不同: 当前值=" + this.validityPeriod + ", 比较值=" + other.validityPeriod);
            return false;
        }

        if (!Objects.equals(this.autoRefundExpired, other.autoRefundExpired)) {
            log.info("autoRefundExpired数据不同: 当前值=" + this.autoRefundExpired + ", 比较值=" + other.autoRefundExpired);
            return false;
        }

        if (!Objects.equals(this.anytimeRefund, other.anytimeRefund)) {
            log.info("anytimeRefund数据不同: 当前值=" + this.anytimeRefund + ", 比较值=" + other.anytimeRefund);
            return false;
        }

        if (!Objects.equals(this.usageNotes, other.usageNotes)) {
            log.info("usageNotes数据不同: 当前值=" + this.usageNotes + ", 比较值=" + other.usageNotes);
            return false;
        }

        if (!Objects.equals(this.remarks, other.remarks)) {
            log.info("remarks数据不同: 当前值=" + this.remarks + ", 比较值=" + other.remarks);
            return false;
        }
        // 使用Objects.equals处理可能为null的字段
        return true;
    }

}
